home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1997 August
/
Walnut Creek CDROM.7z
/
LISTINGS
/
V_12_05
/
ALLISON.ZIP
/
LOCAL.CPP
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
C/C++ Source or Header
|
1994-03-04
|
420 b
|
36 lines
LISTING 6 - Defines a Local class
#include <iostream.h>
int i = 10;
main()
{
void f();
f();
return 0;
}
void f()
{
static int j = 20;
class Local
{
int k;
public:
Local(int i) : k(i) {}
void a() {cout << k+i << endl;}
void b() {cout << k+j << endl;}
};
Local l(30);
l.a();
l.b();
}
/* Output:
40
50
*/